#ifndef _LOCKGUARD_HPP_
#define _LOCKGUARD_HPP_
#include<pthread.h>
class LockGurad
{
public:
    LockGurad(pthread_mutex_t& mutex):
    mutex_(mutex)
    {
        pthread_mutex_lock(&mutex_);//加锁
    }
    ~LockGurad()
    {
        pthread_mutex_unlock(&mutex_);//解锁
    }
private:
   pthread_mutex_t& mutex_;
};
#endif
